/**
 * @program: leetcode070
 * @author: JCM
 * @create: 2022-11-26 14:53
 * @description: 爬楼梯
 **/
public class LeetCode070 {
    public int climbStairs(int n) {
        if(n < 3) return n;
        int f1 = 1,f2 = 2;
        int f3 = 0;
        while(n-- > 1) {
            f3 = f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f1;
    }
}
